package com.cakebackoffice.clientsoap.contract;


import org.ksoap2.serialization.NullSoapObject;
import org.ksoap2.serialization.SoapObject;

public class PaymentType extends ContractObject {

    public int id;
    public String name;
    public float bookingFee;

    public PaymentType() {
    }

    public PaymentType(com.cakebackoffice.Model.PaymentType paymentType) {
        id = Integer.valueOf(paymentType.getRemoteID().toString());
        name = paymentType.getName();
        bookingFee = paymentType.getBookingFee();
    }

    @Override
    public void fill(SoapObject soapObject) {
        if (!(soapObject.getPropertySafely("id") instanceof NullSoapObject))
            this.id = Integer.parseInt(soapObject.getPropertySafelyAsString("id"));
        if (!(soapObject.getPropertySafely("name") instanceof NullSoapObject))
            this.name = soapObject.getPropertySafelyAsString("name");
        if (!(soapObject.getPropertySafely("bookingFee") instanceof NullSoapObject))
            this.bookingFee = Float.parseFloat(soapObject.getPropertySafelyAsString("bookingFee"));
    }
}
